﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Honestysoft.BaseObject;
using System.Data;
using Honestysoft.Financing.Model;

namespace Honestysoft.Financing.WebUI.Module.Reports.JSON
{
    /// <summary>
    /// GetZFHZ 的摘要说明
    /// </summary>
    public class GetZFHZ : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string type = context.Request.Params["type"];
            if (type == "0")//得到批次的资金支付申请初审情况汇总表上报日期
            {
                QueryParameters query = new QueryParameters();
                query.Add("BatchNo", Convert.ToInt32(context.Request.Params["ID"]), QueryParameters.OperatorType.Equal);
                DataTable dt = new BaseBusinessLogic<Bu_BatchSummary>().GetTable(query);
                if (dt == null || dt.Rows.Count == 0)
                {
                    context.Response.Write("");
                }
                else
                {
                    if (string.Format("{0:yyyy-MM-dd}", dt.Rows[0]["PrintDate"]) == "1900-01-01")
                    {
                        context.Response.Write("");
                    }
                    else
                    {
                        context.Response.Write(string.Format("{0:yyyy-MM-dd}", dt.Rows[0]["PrintDate"]));
                    }
                }
            }
            else
            {
                context.Response.Write("");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}